﻿using System;
using System.Xml.Linq;
using FarseerGames.FarseerPhysics.Mathematics;

namespace FreeGoo.LevelClasses.LevelParts
{
    public abstract class LevelPart : Part
    {
        public static float ConvertDegreesToRadians(float degrees)
        {
            return (float)(Math.PI / 180) * degrees;
        }

        public static float ConvertRadiansToDegrees(float radians)
        {
            return radians * (float)(180.0 / Math.PI);
        }

        public Vector2 GetOffsetPosition(Level level, Vector2 position)
        {
            return position + level.PositionOffset;
        }

        public Vector2 GetOffsetPosition(Level level, XElement element)
        {
            return GetOffsetPosition(level, element.Attribute("Position").ToVector2());
        }
    }
}